<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title>Title</title>

    <script src="jquery-3.7.1.min.js"></script>
</head>
<body>
<%--<a href="http://localhost:8080/mvc/user">获取用户信息</a>--%>

<button id="btn">跨域访问用户信息</button>

<script>

    $(function () {

        $("#btn").click(function () {

            $.ajax({
                type: "post",
                url: "http://localhost:8080/mvc/user",
                contentType: "application/json;charset=utf-8",
                success: function (data) {
                    console.log(data.name)
                    console.log(data.gender)
                    console.log(data.age)
                    console.log(data.address)
                }
            })
        })

    })

</script>
</body>
</html>
